#include <stdio.h>
#include <stdlib.h>

int client(int den, int num) {
    int ratio =0 ;  
    if (den <= 0 || num <= 0) {
        ratio = 0;
    }
    else if(den > 0 && 16 > num){
        if(num < 8){
            int dtemp = den ,ntemp = num;
            int countd = 0, countn = 0;

            while(dtemp){
                countd+=1;
                dtemp/=10;
            }
            while(ntemp){
                countn+=1;
                ntemp/=10;               
            }
            int max = 1 ,min =1;  
            if(countn > countd){
                for(int t1 = 1;t1<=countd;t1++)
                    max*=10;  
                for(int t2 = 1;t2<=countn;t2++)
                    min*=10;
            } 
            else{
                for(int t1 = 1;t1<=countd;t1++)
                    min*=10;  
                for(int t2 = 1;t2<=countn;t2++)
                    max*=10;
            }
            ratio = max;
        }  
        else{
            while(num<16){
                ratio += -1;
                num++;
            } 
            ratio = num;      
        }
        ratio = den+num;
    }
    else{
        if(den < 0)
            den = -den;
        num = 256;
        while(num>0){
            ratio = ratio +1;
            num--;
        }
        ratio = -2;
    }

    return ratio;
}


int main(int argc, char *argv[]) {
    // 检查输入参数的数量
    if (argc != 3) {
        return 1; // 返回非零值表示出错
    }

    // 将命令行参数转换为整数
    int den = atoi(argv[1]);
    int num = atoi(argv[2]);

    int ratio = 0, flag = -1;
    if (num >16 && num <32 ){
    //if (num >60){
        //ratio = client(den, num);
        //ratio = client(den*2, num);
        ratio = client(den, num/2);
        flag=1;
    }
    else{
        ratio = client(den, num);        
        flag=2;
    }
    // 输出结果
    printf("\n%d, %d\n", ratio, flag);

    // 返回零表示成功执行
    return 0; 
}
